<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script>
        var str = '';
        var arr = ['red','green','blue','pink'];
        var sep = '|';
        for (var i = 0 ;i < arr.length;i++){
            str +=  arr[i]+sep;
        }

        console.log(str);
    </script>
</head>
<body>

</body>
</html>